Here are some examples of macro definitions:<$MACRO
MacroName [ flags ] [ attributes ]>
...macro text...
</$MACRO>
MyAddress
that only is a
shortcut for your email-address like
<$MACRO MyAddress> hugo@some.where </$MACRO>So every time, you insert the macro-tag
<MyAddress>
in your hsc-source, it will be replaced by
hugo@some.wherein the HTML-object.
One of the most embarassing facts within HTML are physical/logical
styles. Taking a look at the HTML 3.0 proposed things, you find
loads of new styles: <AU>
for authors, <SAMP>
for
sequences of litteral characters
and so on... No one knows where this will end, and I'm just waiting
for logical styles like
<TIM_BERNERS_LEE_S_LOGICAL_STYLE_TO_RENDER_THE_NAME_OF_HIS_DOG>
.
(Which would asume that TBL has a dog)
<$MACRO FILE><I></$MACRO> <* enable italic *> <$MACRO /FILE></I></$MACRO> <* disable italic *>Your new style can be used like all other styles:
..open the file <FILE>hugo.txt</FILE> and..In this case, filenames will be rendered italic:
..open the file hugo.txt and..
This seems much more reasonable to me then producing heaps of logical styles, but..
Note that you just created a container that requires an start- and end-tag.<$MACRO BUTTON_NEXT NxtRef:uri> <A HREF=(NxtRef)><IMG SRC=":image/next.gif" ALT="Next"></A> </$MACRO>This defines a macro that defines a button that references to the next page. As every page has its own next page, you can set one attribute for this macro:
NXTREF
, which is the URI that should be referenced as the "next"
page.So an example usage of this macro would be:
<BUTTON_NEXT NXTREF=":features/rplcent.html">which will give the button seen below:
Note that the value of NXTREF
is passed to the HREF
attribute within the <A>
tag when the macro is extracted.
If you wonder, what HREF=(NxtRef)
(see above) should
mean: This sets HREF
with the value stored in
NxtRef
. For details, read the section about
expressions.
Macro attributes can only be defined within opening macros. The coresponding closing macro automatically inherits all attributes of its opening macro. This seems more HTML-like to me.
SGML is able to handle macros.
To make your macros more powerful and flexible, you can use expressions and conditional conversion.